package dao

import (
	"context"
	"time"
	"zk507/common/inits"
	"zk507/common/models"
)

func SetSms(mobile, source, code string) error {
	err := inits.Rdb.Set(context.Background(), mobile+source, code, time.Minute*5).Err()
	if err != nil {
		return err
	}
	return nil
}

func GetSms(mobile string) string {
	return inits.Rdb.Get(context.Background(), mobile+"login").Val()
}

func DelSms(mobile string) error {
	return inits.Rdb.Del(context.Background(), mobile+"login").Err()
}

func Set(list []*models.Information) error {
	return inits.Rdb.Set(context.Background(), "information", list, time.Hour*5).Err()
}
